<?php
namespace Topxia\Service\Kuke\Impl;

use Topxia\Common\ArrayToolkit;
use Topxia\Service\Common\BaseService;
use Topxia\Service\Kuke\FankuiService;

class FankuiServiceImpl extends BaseService implements FankuiService
{
	public function submit($conditions)
	{
		$fields['daan']			= isset($conditions['a1']) && !empty($conditions['a1']) ? 1 : 0;
		$fields['tigan']		= isset($conditions['a2']) && !empty($conditions['a2']) ? 1 : 0;
		$fields['xuanxiang']	= isset($conditions['a3']) && !empty($conditions['a3']) ? 1 : 0;
		$fields['tupian']		= isset($conditions['a4']) && !empty($conditions['a4']) ? 1 : 0;
		$fields['jiexi']		= isset($conditions['a5']) && !empty($conditions['a5']) ? 1 : 0;
		$fields['shuoming']		= isset($conditions['a6']) && !empty($conditions['a6']) ? $conditions['a6'] : '';
		$go = false;
		foreach ($fields as $k =>$v){
			if(!empty($v)) $go=true;
		}
		if(!$go)
			return array('status'=>'err', 'message'=>'提交的信息为空', 'id'=>2);
		$res = $this->getFankuiDao()->submit($fields);
		if($res){
			return array('status'=>'ok', 'message'=>'提交成功', 'id'=>0);
		}else{
			return array('status'=>'err', 'message'=>'提交失败', 'id'=>1);
		}
	}
	
	protected function getFankuiDao()
	{
		return $this->createDao('Kuke.FankuiDao');
	}
}